// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import MintUI from 'mint-ui'
import App from './App'
import router from './router'
import store from './store'
import moment from 'moment'
import './permission' // permission control
import { LoadingPlugin } from 'vux'
import 'mint-ui/lib/style.css'
Vue.use(MintUI)

Vue.use(LoadingPlugin)

Vue.config.productionTip = false

Vue.prototype.$moment = function(value, formatString) {
  formatString = formatString || 'YYYY-MM-DD HH:mm:ss'
  // return moment(value).format(formatString); // value可以是普通日期 20170723
  if (!value) {
    return ''
  }
  const ftm = moment(value).format(formatString) // 这是时间戳转时间
  return ftm
}

// 注册全局moment过滤器
Vue.filter('moment', Vue.prototype.$moment)

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
